package fields;

import java.io.RandomAccessFile;
import java.util.ArrayList;

import data.AbstractDataType;

import fileProcessing.ParsingException;

public abstract class AbstractField {
	public String name;
	public ArrayList<String> fieldCategory = new ArrayList<String>();
	
	public AbstractField(String fieldName,String category){
		name = fieldName;
		for(String s : category.split(","))
			fieldCategory.add(s);
	}
	
	/**
	 * Getter for the field name.
	 * @return Explicit name of the field as determined from the input document.
	 */
	public String getFieldName(){
		return name;
	}
	public abstract void addData(RandomAccessFile dataFile, String line) throws ParsingException;
	
	/**
	 * Getter for the values stored in a table's random access file.
	 * @return corresponding field value from the data file.
	 */
	public abstract AbstractDataType getValue(RandomAccessFile dataFile) throws ParsingException;
	
	/**
	 * Checks to see if a value meets a specific structure of a field.
	 * Ambiguous structure is considered a separate state and refers to 
	 * input which can take multiple forms while still satisfying the field's data.
	 * @return 0 if false, 1 if true, or 2 if input matches ambiguous structure 
	 */
	public abstract int verify(String s);
	
}
